
CC=@CC@
CPPFLAGS = -I../ @MYCPPFLAGS@
CFLAGS = @MYCFLAGS@
LDFLAGS = -L../ @MYLDFLAGS@
CMDLDFLAGS =
LIBS = -lcunit -ltcejdb @LIBS@
RUNENV = LD_LIBRARY_PATH=.:.. DYLD_LIBRARY_PATH=.:..

TESTS = t1 t2 t3 t4

check : all check-t1 check-t2 check-t3 check-t4;

check-valgrind :
	make RUNCMD="valgrind --tool=memcheck --leak-check=full --error-exitcode=1" check

check-valgrind-t2 :
	make RUNCMD="valgrind --tool=memcheck --leak-check=full --error-exitcode=1" check-t2

check-valgrind-t3 :
	make RUNCMD="valgrind --tool=memcheck --leak-check=full --error-exitcode=1" check-t3

check-valgrind-t4 :
	make RUNCMD="valgrind --tool=memcheck --leak-check=full --error-exitcode=1" check-t4

check-t1 :
	$(RUNENV) $(RUNCMD) ./t1

check-t2 :
	$(RUNENV) $(RUNCMD) ./t2

check-t3 :
	$(RUNENV) $(RUNCMD) ./t3

check-t4 :
	$(RUNENV) $(RUNCMD) ./t4


all : $(TESTS)

clean :
	rm -rf *.o $(TESTS) db* *.vlog

t1 : t1.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)

t2 : t2.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)

t3 : t3.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)

t4 : t4.o
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)


.PHONY : all clean check check-t1 check-t2 check-t3 check-t4

